
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改检测方法</title>
    <meta name="keywords" content="修改检测方法">
    <meta name="description" content="修改检测方法">
    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="${WEB_PATH}/resources/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/style.min.css?v=5.0.0" rel="stylesheet"><base target="_blank">
	<link href="${WEB_PATH}/resources/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
	<link href="${WEB_PATH}/resources/css/plugins/treeview/bootstrap-treeview.css" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/plugins/jsTree/style.min.css" rel="stylesheet">
	<link href="${WEB_PATH}/resources/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
	
</head>

<body>
	<div class="col-sm-12">
		<form class="m-t" id="edit">
			 <input type="hidden" name="ID" value="${companySection.ID}" />
             <input  type="hidden" name="queryCode" id="queryCode" id= value="${queryCompanySection.code}" />
            <div class="form-group">
                <label>机构名称：</label>
                <input id="name" name="name" class="form-control"   value="${companySection.name}" required="" aria-required="true"  placeholder="请输入机构名称">
            </div>
            <div class="form-group">
                <label>机构编码：</label>
                <input id="code" name="code" class="form-control" value="${companySection.code}"  required="" aria-required="true"  placeholder="请输入机构编号">
            </div>
            <#if queryCompanySection??>
			 <div class="form-group">
				 <label>业务权限：</label>
				    <div class="input-group colorpicker-demo2 colorpicker-element">
					   <input id="ywqx"  class="form-control dropdown-toggle" readonly type="text" placeholder="请选择业务权限"  value="${queryCompanySection.name}" style="background-color: #fff;" >
					   <span class="dropdown-toggle input-group-addon  btn btn-white btn-bitbucket" data-toggle="dropdown" id="organization"><i class="fa fa-user-md"></i></span>
					   <div class="dropdown-menu m-t-xs pull-right" id="organization_tree" style="width: 100%;">
					         <div id="using_json1" class="test"></div>
					   </div>
				    </div>
			 </div>
            </#if>
              <div class="form-group">
                <label>排序：</label>
                <input name="soft" type="number" class="form-control" value="${companySection.soft}">
            </div>
            <div class="form-group">
                 <label>备注：</label>
                 <input type="text" name="descs" class="form-control"  value="${companySection.descs}" >
            </div>
        </form> 
	</div>
    <script src="${WEB_PATH}/resources/js/jquery.min.js?v=2.1.4"></script>
    <script src="${WEB_PATH}/resources/js/ajax.extend.js"></script>
    <script src="${WEB_PATH}/resources/js/bootstrap.min.js?v=3.3.5"></script>
	<script src="${WEB_PATH}/resources/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/wizard/jquery.bootstrap.wizard.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/validate/messages_zh.min.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/validate/jquery.validate.method.js"></script>
	<script src="${WEB_PATH}/resources/js/plugins/layer/layer.js"></script> 
	<script src="${WEB_PATH}/resources/js/plugins/jsTree/jstree.min.js"></script>
	<script src="${WEB_PATH}/resources/js/plugins/sweetalert/sweetalert.min.js"></script>
	<script src="${WEB_PATH}/resources/js/plugins/chosen/chosen.jquery.js"></script>
	<script>
	$(function(){
	  <#if queryCompanySection??>
		 $('#using_json1').jstree({
            'core': {
                    'data': ${json}
            }
	        }).bind('changed.jstree', function(event,data) {
	        	$(".pName").text(data.node.text);
	        	$("#queryCode").val(data.node.original.code);
	        	$("#organization_tree").hide();
	        	 $("#ywqx").val(data.node.text);
	        }).bind('dblclick.jstree', function(event) {
		}).bind('click.jstree', function(event){
			 event.stopPropagation();
		});
	 </#if>
	 
	 $("#organization").on("click",function(){
			var display =$('#organization_tree').css('display');
			if(display == 'none'){
			  $("#organization_tree").show();
			}else{
			  $("#organization_tree").hide();
			}
		});
    });
	var e = "<i class='fa fa-times-circle'></i> ";
	$("#edit").validate({
	 	rules: {
        	name: {
                required: !0,
            },
            code: {
            	required: !0,
            }
        },
        messages: {
            CODE: {
                remote: e + "账号名称重复。"
            }
        },
        errorPlacement: function(error, element) {
        	element.before(error);
         }
   });
     //添加用户信息#commentForm
 	function saveEditForm(){
 		if($("#edit").valid()){
			$.yilinAjax({
		   	  	type:'POST',
		   	  	loadmsg:'努力提交中......',
		   	     url: '${WEB_PATH }/system/companysection/edit.do',  
		   	  	data:$('#edit').serialize(),
        		errorcallback:null,
        		btn:null,
        		successcallback:success
	   	    });
    	 }
 	}
 	
 	function success(result){  
 		if(result.success == true){
			 layer.alert('<font color="#1ab394">'+result.msg+'</font>', {
			  	skin: 'layui-layer-molv',
			  	icon: 1,
			  	closeBtn: 0
			},function(){
				parent.location.reload();
			   	var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
			   	parent.$('#add').attr("disabled",false);
				parent.layer.close(index); 
			   
			});
		}else{ 
	    	layer.msg(result.msg, {icon: 5}); 
		} 
    }
  </script>
</body>
</html>